from FiveOneJobFetch import PageFetch
from bookInfo import Book
from bookInfo import DownLoadInfo
from bookOpe import BookOperator

def main(url):
    p = PageFetch(url);
    shortPageList = p.getBookPageList();
    bookOperator = BookOperator();
    downPage= [];
    for page in shortPageList:
        downLoadPage =  PageFetch.getDownloadPage(page);
        downPage = downPage+downLoadPage;
    for bookDownLoadPage in downPage:
        book  = PageFetch.getBookInfo(bookDownLoadPage);
        bookOperator.addBookInfo(book);
    print ("数据抓取成功:"+url);

if __name__ == '__main__':
    urls = ["list152_35.html","list300_2.html","list476_6.html","list977_2.html","list572_5.html","list509_2.html","list481_1.html","list576_1.html","list482_1.html","list483_1.html","list484_1.html"];
    for url in urls:
        main(url);
